package com.springboot.Controller;

import com.alibaba.fastjson.JSONObject;
import com.springboot.Service.ProvinceService;
import com.springboot.domain.Province;
import com.springboot.domain.ProvinceCity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import javax.xml.ws.Response;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

/**
 * @author 权哥
 * @version 1.0
 * @date 2022/5/5 22:07
 */
@RestController
public class ProvinceController {

    String province=null;
    int days=0;

    @RequestMapping(value = "/getProvinceDays",method = RequestMethod.POST)
    public void getResult(@RequestBody JSONObject jsonObject){

        province=jsonObject.getString("provinceName");
        days=Integer.parseInt(jsonObject.getString("days"));
        System.out.println("省份："+province+"  ,查询天数："+days);

    }



    @Autowired
    ProvinceService provinceService;
    @GetMapping("/province")
    public ArrayList<Province> getProvinceList() throws IOException {

        return provinceService.ProvinceList(province,days);
    }
}
